<template>
    <div>
        <el-dialog
            v-model="updateVisible"
            :destroy-on-close="true"
            :close-on-click-modal="false"
            title="修改功能点"
            @close="handleClose"
        >
            <el-form :model="func">
               
                <el-form-item label="功能名称" :label-width="formLabelWidth">
                    <el-input v-model="func.name" autocomplete="off" />
                </el-form-item>
                <el-form-item label="路由路径" :label-width="formLabelWidth">
                    <el-input v-model="func.path" autocomplete="off" />
                </el-form-item>
              
            </el-form>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="updateVisible = false"
                        >取消</el-button
                    >
                    <el-button type="primary" @click="handleUpdate">
                        确定
                    </el-button>
                </span>
            </template>
        </el-dialog>
    </div>
</template>
<script setup>
import { ElMessage } from "element-plus";
import { defineEmits, ref,reactive } from "vue";
import { Plus } from '@element-plus/icons-vue'
import { storeToRefs } from "pinia";
import { updateFunction } from "../../../services/function";
import { useFunctionStore } from "../../../stores/function";
const emit = defineEmits(["show"]);

const functionStore = useFunctionStore();
const {updateVisible,func} = storeToRefs(functionStore);

const formLabelWidth = ref(100);

const handleClose = () => {};
const handleUpdate = async () => {
    await updateFunction(func.value);
    updateVisible.value = false;
    emit("show");
};
</script>
<style scoped>
.add-btn {
    display: flex;
    justify-content: flex-end;
}
.avatar-uploader {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}

.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 120px;
  height: 120px;
  text-align: center;
}
</style>
